-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiler: Fix bug in snapshotting #5518
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is still a problem here that snapshot_element calls snapshot_component again for the enclosing component
I think you'll have to either
- use Rc::new_cyclic, and pass the enclosing component in snapshot_element, or
- keep the enclosing element empty, and set it later once the component is complete.
I think i'd go with option 1
I tried the new_cyclic approach. I have the problem that some of the elements are first discovered elsewhere than via the component they belong to (I had actually not expected that!). So I see elements created as ElementRcs... which is a problem if one of those is later discovered to be root element. I have been playing with separating having a I get lots of asserts triggered with that approach :-/ |
I think it works now. After way too many stupid bugs and some surprising behavior in how and when elements are created... |
/me sighs. Left in a variable I had added to debug things. |
94bbdfa
to
4b42e42
Compare
I used the stable order of struct fields (#5561) to debug-print the components and elements I snapshot and to compare that output to the same from the original components and elements. Nothing asserts anymore, they all produce the same debug strings. That's a step into the right direction... BUT I see the |
Funny... I find elements with a base_type of |
The latest version fixes the base_type is Error problem I had earlier. It works when asserting that all components and elements are not equal to their snapshot and that the debug output of any component/element is identical with their snapshot. |
Do not `take` an ElementRc to move it into the `Component`'s `root_element`. @ogoffart spotted this! Thanks!
Do not
take
an ElementRc to move it into theComponent
'sroot_element
.@ogoffart spotted this! Thanks!